<template>
  <div class="square">
    <div class="square-icon">
      <div>
        <i class="el-icon-position" style="font-size: 2rem"></i>
      </div>
    </div>
    <div class="square-text">
      <div>{{ title }}</div>
      <div class="square-text-line"></div>
      <div>
        {{ formatValue }}
        <span class="square-unit">{{unit}}</span>
      </div>
    </div>
  </div>
</template>

<script>
import { NumFormat } from '../utils'

export default {
  name: 'SquareItem',
  props: ['title', 'value', 'unit'],
  computed: {
    formatValue({value}) {
      return NumFormat(value);
    }
  }
}
</script>

<style scoped>
.square {
  border-radius: inherit;
  border: inherit;
  width: 100%;
  display: flex;
  /* box-sizing: border-box; */
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid #292c33;
}
.square-icon {
  margin-left: 10%;
  margin-right: 15%;
  width: 15%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.square-icon > div {
  padding: 50%;
  background-color: rgba(255, 255, 255, 0.03);
}
.square-text {
  width: 60%;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
}
.square-text > div {
  flex: 1 1 auto;
  width: 100%;
}
.square-text > div:first-child {
  display: flex;
  align-items: end;

  color: rgb(255, 255, 255);
  font-weight: lighter;
  font-family: AlibabaPuHuiTi, Arial, 'sans-serif';
  font-size: 0.9375rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  line-height: normal;
  margin: 0 0 0.125rem;
  justify-content: flex-start;
}
.square-text > div:last-child {
  display: flex;
  align-items: baseline;
  color: rgb(33, 241, 242);
  text-align: center;
  white-space: nowrap;
  justify-content: flex-start;
  font-family: AlibabaSans;
  background-color: rgba(0, 0, 0, 0);
}
.square-text .square-text-line {
  flex: 0 0 0.0625rem;
  background: #fff;
  opacity: 0.2;
}
.square-unit {
  text-align: left;
  color: rgb(208, 210, 212);
  font-weight: normal;
  font-family: arial;
  font-size: 0.75rem;
  line-height: 0.8125rem;
  text-indent: 0;
  letter-spacing: 0;
  word-break: break-all;
  display: flex;
  align-items: center;
  margin-left: auto;
}
</style>
